home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug106 / otoi.c < prev    next >
Text File  |  1984-06-14  |  2KB  |  48 lines

  1. /*
  2.     otoi(n)
  3.  
  4.     this function converts an offset octal number in ASCII
  5.     to an integer. the number is in the format xxx.xxx{a} and
  6.     may be preceeded by white space.
  7. */
  8.  
  9. otoi(n)
  10. char *n;
  11. {
  12.     int val, b, i;
  13.     char c;
  14.  
  15.     val = 0; b = 16384;
  16.  
  17.     while ((c = *n) == '\t' || c == ' ') ++n;
  18.     for (i = 0; i < 7; i++) {
  19.        if ((c = *n) == '.') {++n; b = 64;}
  20.        else {c = *n++; val = val + (b * (c - '0')); b /= 8;}
  21.     }
  22.     return val;
  23. }
  24.  
  25. /*------------------------------------------------------------------*/
  26. /*                                                                  */
  27. /*  This is a library of private routines for use with BDS C prog-  */
  28. /*  grams.  The comment lines preceding each entry are intended     */
  29. /*  to give a sufficient explanation of the routine that follows.   */
  30. /*  To link any of these routines to a BDS C program, merely name   */
  31. /*  PRVLIB as a argument following the name of the main program in  */
  32. /*  the CLINK command line.                                         */
  33. /*                                                                  */
  34. /*------------------------------------------------------------------*/
  35.  
  36.  
  37. /*
  38.     Move k bytes from blk1 to blk2.  
  39.     The two blocks may overlap.
  40.     Since k must be positive, this routine is limited to
  41.     moving blocks less than 32k in length.
  42.     Added by M. Goldberg, 25-DEC-79. 
  43. */
  44. movblk(blk1, blk2, k) 
  45.     char *blk1, *blk2;
  46.     int k;
  47.     {
  48.     int m,